﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadLoaddedinInfo();
        }
    }

    private void loadLoaddedinInfo()
    {
        if (Session["OnlineSMS_LoginID"] != null)
        {
            hfLoginID.Value = Session["OnlineSMS_LoginID"].ToString();
            //Session.Remove("OnlineSMS_LoginID");
        }

        if (hfLoginID.Value.Length > 12)
        {
            string loginID = hfLoginID.Value.Substring(6, hfLoginID.Value.Length - 6).Substring(0, hfLoginID.Value.Length - 12);

            string sql = @"select [dbo].[GetRemainingSMSByLoginID]("+loginID+@")";

            DataSet ds = DatabaseManager.ExecSQL(sql);

            lblLoggedinInfo.Text = decimal.Parse(ds.Tables[0].Rows[0][0].ToString()).ToString("0,0") + " SMS Remaining&nbsp;";
        }
        else
        {
            Response.Redirect("Default.aspx");
        }

    }
}
